package com.yw.common.core.db.test;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.google.gson.reflect.TypeToken;
import com.yw.common.core.db.IDBConnection;
import com.yw.common.core.db.dao.IRetrieve;
import com.yw.common.core.db.dao.impl.DefaultBrowseDaoImpl;
import com.yw.common.core.db.dao.impl.DefaultUpdateDaoImpl;
import com.yw.common.core.db.dao.proxy.DefaultBrowseDaoProxy;
import com.yw.common.core.db.dao.proxy.DefaultUpdateDaoProxy;
import com.yw.common.core.db.exception.DBOpenException;
import com.yw.common.core.db.test.entity.PoMenu;
import com.yw.common.core.db.test.entity.PoStudent;
import com.yw.common.core.util.DbUtil;


/**
 * dao测试
 * @author aoshiguchen
 * @time 2015-12-03
 */

public class DaoTest1 {
	
	public static void main(String[] args) throws Exception {
		//IUpdateDao dao = new DefaultUpdateDaoProxy(new DefaultUpdateDaoImpl("Student"));
		//IRetrieve dao = new DefaultUpdateDaoProxy(new DefaultUpdateDaoImpl("Student"));
		//IRetrieve dao = new DefaultBrowseDaoProxy(new DefaultBrowseDaoImpl("Student"));
		//IRetrieve dao = new DefaultBrowseDaoProxy(new DefaultBrowseDaoImpl<PoStudent>("PoStudent"){});
		
//		IRetrieve dao = new DefaultBrowseDaoProxy(new DefaultBrowseDaoImpl<PoStudent>("Student"){});
//		System.out.println(dao.findAll());
		
		//test1();
		
//		Persion<Integer> foo = new Persion<Integer>(){};
//		
//		
//		foo.hello();
		
//		Persion<Integer> foo = new Persion<Integer>();
//		
//		foo.hello();

 	}
	
	public static void test1() throws Exception{
		IDBConnection conn = DbUtil.getDBConnection();
		
		conn.open();
		
		PreparedStatement ps = conn.prepareStatement("SELECT Name FROM SysColumns WHERE id=Object_Id('Student')");
		
		ResultSet rs = ps.executeQuery();
		
		while(rs.next()){
			System.out.println(rs.getString("name"));
		}
		
		
		conn.close();
	}
	
}
